package org.lyg.domain;

import org.springframework.web.util.HtmlUtils;

import java.util.Date;

public class Blog {
    private int id;
    private String title;
    private String content;
    private Date createTime;
    private Date editTime;
    private User author;
    private Tag tag;
    private Boolean isDel;

    public Blog(){}

    public Blog(int id) {
        this.id=id;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getEditTime() {
        return editTime;
    }

    public void setEditTime(Date editTime) {
        this.editTime = editTime;
    }

    public User getAuthor() {
        return author;
    }

    public void setAuthor(User author) {
        this.author = author;
    }

    public Tag getTag() {
        return tag;
    }

    public void setTag(Tag tag) {
        this.tag = tag;
    }

    public Boolean isDel() {
        return isDel;
    }

    public void setDel(Boolean del) {
        isDel = del;
    }

    public String getContentSingleLine(){
        return content.replaceAll("[\n|\r]","").replaceAll("[\"|']","\\\"");
    }

    @Override
    public String toString() {
        return "Blog{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", createTime=" + createTime +
                ", editTime=" + editTime +
                ", author=" + author +
                ", tag=" + tag +
                '}';
    }
}
